package com.t382.text.controller;

import com.t382.text.pojo.HotSpotConsultation;
import com.t382.text.pojo.Interceptors;
import com.t382.text.pojo.Page;
import com.t382.text.pojo.Replies;
import com.t382.text.service.InterceptorsService;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@ResponseBody
@Controller
@RequestMapping("/ccx")
public class IntController {
    @Autowired
    private InterceptorsService interceptorsService;

    @RequestMapping("/page")
    public Page page(@RequestParam Integer pageNo, @RequestParam Integer pageSize) {
        Page page = interceptorsService.getPage(pageNo, pageSize);
        System.out.println(page);
        return page;
    }

    @DeleteMapping("/delete/{id}")
    public int delete(@PathVariable Integer id) {
        return interceptorsService.delete(id);
    }

    @RequestMapping("/wrj")
    public List<HotSpotConsultation> wrj(@RequestParam int id) {
        List<HotSpotConsultation> list = interceptorsService.getReplies(id);
        return list;
    }

    @RequestMapping("/update1")
    public int update1(@RequestParam int id) {
        return interceptorsService.update1(id);
    }

    @RequestMapping("/insert")
    public int update2(@RequestBody Replies replies) {
        return interceptorsService.update2(replies);
    }

    @RequestMapping("/update3")
    public int update3(@RequestParam Integer id) {
        return interceptorsService.update3(id);
    }

}
